<%--
  Created by IntelliJ IDEA.
  User: pangshu
  Date: 2022/7/22
  Time: 23:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String path = request.getContextPath()+"/";%>
<base href="<%=path%>">
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="toList" method="get">
    <div>
        用户名：<input type="text" name="userName"><input type="submit" value="查询"><input type="button" value="新增" onclick="toEditOne()">
    </div>
    <div>
        <table>
            <thead>
                <tr>
                    <th>序号</th>
                    <th>姓名</th>
                    <th>用户名</th>
                    <th>密码</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>
        </table>
        <c:forEach items="${page.list}" var="user" varStatus="t">
            <tr>
                <th>${t.index+1}</th>
                <th>${user.userCode}</th>
                <th>${user.userName}</th>
                <th>${user.userPassword}</th>
                <th>${user.userState}</th>
                <th>
                    <input type="button"value="修改" onclick="toEdit(${user.userId})">
                    <input type="button"value="删除"onclick="deleteById(${user.userId})">
                </th>
            </tr><br>
        </c:forEach>
    </div>
</form>
</body>
<script type="text/javascript">
    function toEdit(id){
        document.location.href="edit?id="+id;
    }
    function deleteById(id){
        document.location.href="deleteById?id="+id;
    }
    function toEditOne(){
        document.location.href="edit";
    }
</script>
</html>
